package dynsim.simulator.iteratedmap.system.impl;

import dynsim.simulator.iteratedmap.system.AbstractIteratedMap;

public class Ikeda extends AbstractIteratedMap {

	// 0.7-0.9
	private double a;

	public Ikeda() {
		setInitialCondition("x", 0.1);
		setInitialCondition("y", 0.1);
		setParameter("Param A", 0.9);
	}

	public double[] eval(double[] x) {
		double[] r = new double[getIndependentVarsNum()];
		a = params.getValue("Param A");

		double t = 0.4 - 6 / (1 + (x[0] * x[0]) + (x[1] * x[1]));

		r[0] = 1 + a * (x[0] * Math.cos(t) - x[1] * Math.sin(t));
		r[1] = a * (x[0] * Math.sin(t) + x[1] * Math.cos(t));

		return r;
	}
}